package com.api.phm.domain.query;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.api.common.language.LanguageBean;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

@Data
public class PhmDevicesScoreQuery {
    private Long plcId;
//    private Long ipcId;
    private String plcName;
    private Long lineId;
    private String lineName;
    private Long robotId;
    private String robotName;
    private Long elementId;
    private String elementName;
    private String datCol;
    private String datColName;
    @JsonIgnore
    private String datColLabel;
    private Double Score;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date dateTime;
    @JsonIgnore
    private String appLang;
    public void initLabelValue() throws Exception {
        String strAppLang = StringUtils.isNotBlank(appLang) ? appLang : LanguageBean.getInitLang();
        if (StringUtils.isNotBlank(datColLabel)) {
            this.datColName = LanguageBean.getLangJsonObj(strAppLang, datColLabel);
//            System.out.println(this.datColName);
        }
    }
}
